package com.example.zjx8969.myapplication.database;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

@Dao
public interface UserDao {
    @Query("select * from user")
    List<User> getAll();

    @Query("select * from user where uid in (:ids)")
    List<User> findUserById(String... ids);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(User user);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(List<User> user);

    @Delete()
    void delete(User user);

    @Query("delete from user where uid=:userId")
    void delete(String userId);
}
